package com.primaryedu.ui.app.growstep;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer;
import android.os.Handler;
import android.os.Message;
import android.provider.SyncStateContract;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.VideoView;

import com.bumptech.glide.Glide;
import com.primaryedu.R;
import com.primaryedu.bean.ClassDynamicBean;
import com.primaryedu.data.Contants;
import com.primaryedu.data.GlobalData;
import com.primaryedu.photo.PhotoPreviewIntent;
import com.primaryedu.widget.MyGridView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.zip.Inflater;

/**
 * Created by Thomas on 2018/2/8.
 */

public class ClassdynamicAdapter extends BaseAdapter implements View.OnClickListener {

    private List<ClassDynamicBean.DataBean.ListBean> list = new ArrayList<>();
    private LayoutInflater inflater;
    @SuppressWarnings("unused")
    private Context context;
    private ClassdynamicAdapter.DeleteCallback mCallback;
    //    private ClassdynamicAdapter.ViewHolder viewHolder;
    private ArrayList<String> imagePaths = new ArrayList<>();
    private ClassGridAdapter gridAdapter;
    private ClassDynamicBean.DataBean.ListBean cb;
    private ViewHolder viewHolder;
    private static final int REQUEST_PREVIEW_CODE = 20;

    //响应按钮点击事件,调用自定义接口，并传入View
    @Override
    public void onClick(View v) {
        mCallback.deleteclick(v);
    }

    /**
     * 自定义接口，用于回调按钮点击事件到Activity
     *
     * @author yy
     *         2018-02-02
     */
    public interface DeleteCallback {
        public void deleteclick(View v);
    }

    public ClassdynamicAdapter(Activity context, List<ClassDynamicBean.DataBean.ListBean> list, DeleteCallback callback) {
        this.context = context;
        this.list = list;
        this.inflater = LayoutInflater.from(context);
        this.mCallback = callback;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public int getViewTypeCount() {
        // TODO Auto-generated method stub
        return 3;
    }

    /**
     * 根据position返回相应的Item类型
     */
    @Override
    public int getItemViewType(int position) {
        if (list.get(position).getImages().equals("") && list.get(position).getVideo().equals("")) {
            return 0;
        } else if (list.get(position).getImages() != "" && list.get(position).getVideo().equals("")) {
            return 1;
        } else if (list.get(position).getVideo() != "" && list.get(position).getImages().equals("")) {
            return 2;
        } else {
            return 0;
        }
    }

    @Override
    public Object getItem(int position) {
//        return list.get(position);
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    public void updateClassdynamicView(List<ClassDynamicBean.DataBean.ListBean> nowList) {
        this.list = nowList;
        this.notifyDataSetChanged();//强制动态刷新数据进而调用getView方法
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
//        viewHolder = null ;
        Log.i("yy", " getImages======" + list.get(position).getImages());

        int type = getItemViewType(position);
//        ViewHolder1 holder1 = null;
//        ViewHolder2 holder2 = null;
//        ViewHolder3 holder3 = null;
        cb = list.get(position);
//        if (type == 0) {
//            if (null == convertView) {
//                holder1 = new ViewHolder1();
//                convertView = inflater.inflate(R.layout.item_classdynamic, null);
//                holder1.image = (ImageView) convertView.findViewById(R.id.headIv);
//                holder1.tv_name_dynamic = (TextView) convertView.findViewById(R.id.tv_name_dynamic);
//                holder1.tv_name_class = (TextView) convertView.findViewById(R.id.tv_name_class);
//                holder1.content = (ExpandTextView) convertView.findViewById(R.id.contentTv);
//                holder1.timeTv = (TextView) convertView.findViewById(R.id.timeTv);
//                holder1.deleteBtn = (TextView) convertView.findViewById(R.id.deleteBtn);
//                convertView.setTag(holder1);
//            } else {
//                holder1 = (ViewHolder1) convertView.getTag();
//            }
//
//            //头像
//            Glide.with(convertView.getContext())
//                    .load(Contants.course_api + cb.getPhoto())
//                    .placeholder(R.drawable.default_error)
//                    .error(R.drawable.default_error)
//                    .centerCrop()
//                    .crossFade()
//                    .into(holder1.image);
//            //姓名
//            holder1.tv_name_dynamic.setText(cb.getUserName());
//            holder1.tv_name_class.setText(cb.getClassName());
//            //文字内容
//            if (!TextUtils.isEmpty(cb.getContent())) {
//                holder1.content.setExpand(cb.isExpand());
//                holder1.content.setExpandStatusListener(new ExpandTextView.ExpandStatusListener() {
//                    @Override
//                    public void statusChange(boolean isExpand) {
//                        cb.setExpand(isExpand);
//                    }
//                });
//
//                holder1.content.setText(cb.getContent());
//            }
//            holder1.content.setVisibility(TextUtils.isEmpty(cb.getContent()) ? View.GONE : View.VISIBLE);
////        Log.i("yy", "getView: " + vb.getEndTime());
//
//
//            //时间
//            holder1.timeTv.setText(cb.getCreateTime());
//            //删除
//            if (cb.getUserId().equals(GlobalData.getUserId(context))) {
//                holder1.deleteBtn.setVisibility(View.VISIBLE);
//            } else {
//                holder1.deleteBtn.setVisibility(View.GONE);
//            }
//            holder1.deleteBtn.setOnClickListener(this);
//            holder1.deleteBtn.setTag(position);
//            return convertView;
//        } else if (type == 1) {
//            if (null == convertView) {
//                holder2 = new ViewHolder2();
//                convertView = inflater.inflate(R.layout.item_classdynamic_photo, null);
//                holder2.image = (ImageView) convertView.findViewById(R.id.headIv);
//                holder2.tv_name_dynamic = (TextView) convertView.findViewById(R.id.tv_name_dynamic);
//                holder2.tv_name_class = (TextView) convertView.findViewById(R.id.tv_name_class);
//                holder2.content = (ExpandTextView) convertView.findViewById(R.id.contentTv);
//                holder2.timeTv = (TextView) convertView.findViewById(R.id.timeTv);
//                holder2.deleteBtn = (TextView) convertView.findViewById(R.id.deleteBtn);
//                holder2.gridView = (MyGridView) convertView.findViewById(R.id.gridView);
//                convertView.setTag(holder2);
//            } else {
//                holder2 = (ViewHolder2) convertView.getTag();
//            }
//            //头像
//            Glide.with(convertView.getContext())
//                    .load(Contants.course_api + cb.getPhoto())
//                    .placeholder(R.drawable.default_error)
//                    .error(R.drawable.default_error)
//                    .centerCrop()
//                    .crossFade()
//                    .into(holder2.image);
//            //姓名
//            holder2.tv_name_dynamic.setText(cb.getUserName());
//            holder2.tv_name_class.setText(cb.getClassName());
//            //文字内容
//            if (!TextUtils.isEmpty(cb.getContent())) {
//                holder2.content.setExpand(cb.isExpand());
//                holder2.content.setExpandStatusListener(new ExpandTextView.ExpandStatusListener() {
//                    @Override
//                    public void statusChange(boolean isExpand) {
//                        cb.setExpand(isExpand);
//                    }
//                });
//
//                holder2.content.setText(cb.getContent());
//            }
//            holder2.content.setVisibility(TextUtils.isEmpty(cb.getContent()) ? View.GONE : View.VISIBLE);
////        Log.i("yy", "getView: " + vb.getEndTime());
//
//            holder2.gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));
//            int cols = convertView.getResources().getDisplayMetrics().widthPixels / context.getResources().getDisplayMetrics().densityDpi;
//            cols = cols < 3 ? 3 : cols;
//            //图片
//            holder2.gridView.setNumColumns(cols);
//            Log.i("yy", "getView: " + cb.getImages());
////                imagePaths.clear();
////            if (imagePaths.contains(cb.getImages().replace(",", ""))) {
//////                imagePaths.clear();
////            } else {
////                imagePaths.add(cb.getImages().replace(",", ""));
////            }
//            imagePaths.clear();
//            imagePaths.add(cb.getImages());
//            Log.i("yy", "getView:replace===== " + cb.getImages());
//            Log.i("yy", "getView:imagePaths==== " + imagePaths);
//            gridAdapter = new ClassGridAdapter(context, imagePaths);
//            holder2.gridView.setAdapter(gridAdapter);
//
//            //时间
//            holder2.timeTv.setText(cb.getCreateTime());
//            //删除
//            if (cb.getUserId().equals(GlobalData.getUserId(context))) {
//                holder2.deleteBtn.setVisibility(View.VISIBLE);
//            } else {
//                holder2.deleteBtn.setVisibility(View.GONE);
//            }
//            holder2.deleteBtn.setOnClickListener(this);
//            holder2.deleteBtn.setTag(position);
//            return convertView;
//        } else {
//            if (convertView == null) {
//                holder3 = new ViewHolder3();
//                convertView = inflater.inflate(R.layout.item_classdynamic_video, null);
//                holder3.image = (ImageView) convertView.findViewById(R.id.headIv);
//                holder3.tv_name_dynamic = (TextView) convertView.findViewById(R.id.tv_name_dynamic);
//                holder3.tv_name_class = (TextView) convertView.findViewById(R.id.tv_name_class);
//                holder3.content = (ExpandTextView) convertView.findViewById(R.id.contentTv);
//                holder3.timeTv = (TextView) convertView.findViewById(R.id.timeTv);
//                holder3.deleteBtn = (TextView) convertView.findViewById(R.id.deleteBtn);
//                holder3.vv_video = (VideoView) convertView.findViewById(R.id.vv_video);
//                convertView.setTag(holder3);
//            } else {
//                holder3 = (ViewHolder3) convertView.getTag();
//            }
//            //头像
//            Glide.with(convertView.getContext())
//                    .load(Contants.course_api + cb.getPhoto())
//                    .placeholder(R.drawable.default_error)
//                    .error(R.drawable.default_error)
//                    .centerCrop()
//                    .crossFade()
//                    .into(holder3.image);
//            //姓名
//            holder3.tv_name_dynamic.setText(cb.getUserName());
//            holder3.tv_name_class.setText(cb.getClassName());
//            //文字内容
//            if (!TextUtils.isEmpty(cb.getContent())) {
//                holder3.content.setExpand(cb.isExpand());
//                holder3.content.setExpandStatusListener(new ExpandTextView.ExpandStatusListener() {
//                    @Override
//                    public void statusChange(boolean isExpand) {
//                        cb.setExpand(isExpand);
//                    }
//                });
//
//                holder3.content.setText(cb.getContent());
//            }
//            holder3.content.setVisibility(TextUtils.isEmpty(cb.getContent()) ? View.GONE : View.VISIBLE);
////        Log.i("yy", "getView: " + vb.getEndTime());
//            holder3.vv_video.setVideoPath(cb.getVideo());
//            final ViewHolder3 finalHolder = holder3;
//            holder3.vv_video.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    finalHolder.vv_video.start();
//                }
//            });
//            holder3.vv_video.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
//
//                @Override
//                public void onCompletion(MediaPlayer mPlayer) {
//                    // TODO Auto-generated method stub
//                    mPlayer.start();
//                    mPlayer.setLooping(true);
//                }
//            });
//            //时间
//            holder3.timeTv.setText(cb.getCreateTime());
//            //删除
//            if (cb.getUserId().equals(GlobalData.getUserId(context))) {
//                holder3.deleteBtn.setVisibility(View.VISIBLE);
//            } else {
//                holder3.deleteBtn.setVisibility(View.GONE);
//            }
//            holder3.deleteBtn.setOnClickListener(this);
//            holder3.deleteBtn.setTag(position);
//            return convertView;
//        }

        if (null == convertView) {
            viewHolder = new ViewHolder();
            switch (type) {
                case 0://纯文字
                    convertView = inflater.inflate(R.layout.item_classdynamic, null);
                    viewHolder.image = (ImageView) convertView.findViewById(R.id.headIv);
                    viewHolder.tv_name_dynamic = (TextView) convertView.findViewById(R.id.tv_name_dynamic);
                    viewHolder.tv_name_class = (TextView) convertView.findViewById(R.id.tv_name_class);
                    viewHolder.content = (ExpandTextView) convertView.findViewById(R.id.contentTv);
                    viewHolder.timeTv = (TextView) convertView.findViewById(R.id.timeTv);
                    viewHolder.deleteBtn = (TextView) convertView.findViewById(R.id.deleteBtn);
                    convertView.setTag(viewHolder);
                    break;
                case 1://图片
                    convertView = inflater.inflate(R.layout.item_classdynamic_photo, null);
                    viewHolder.image = (ImageView) convertView.findViewById(R.id.headIv);
                    viewHolder.tv_name_dynamic = (TextView) convertView.findViewById(R.id.tv_name_dynamic);
                    viewHolder.tv_name_class = (TextView) convertView.findViewById(R.id.tv_name_class);
                    viewHolder.content = (ExpandTextView) convertView.findViewById(R.id.contentTv);
                    viewHolder.timeTv = (TextView) convertView.findViewById(R.id.timeTv);
                    viewHolder.deleteBtn = (TextView) convertView.findViewById(R.id.deleteBtn);
                    viewHolder.gridView = (MyGridView) convertView.findViewById(R.id.gridView);
                    convertView.setTag(viewHolder);
                    break;
                case 2://视频
                    convertView = inflater.inflate(R.layout.item_classdynamic_video, null);
                    viewHolder.image = (ImageView) convertView.findViewById(R.id.headIv);
                    viewHolder.tv_name_dynamic = (TextView) convertView.findViewById(R.id.tv_name_dynamic);
                    viewHolder.tv_name_class = (TextView) convertView.findViewById(R.id.tv_name_class);
                    viewHolder.content = (ExpandTextView) convertView.findViewById(R.id.contentTv);
                    viewHolder.timeTv = (TextView) convertView.findViewById(R.id.timeTv);
                    viewHolder.deleteBtn = (TextView) convertView.findViewById(R.id.deleteBtn);
//                    viewHolder.vv_video = (VideoView)convertView.findViewById(R.id.vv_video);
                    viewHolder.video_cover = (ImageView) convertView.findViewById(R.id.video_cover);
                    convertView.setTag(viewHolder);

                    break;
            }
            if (null != convertView) {
                convertView.setTag(viewHolder);
            }
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        final ClassDynamicBean.DataBean.ListBean cb = list.get(position);
        switch (type) {
            case 0:
                //头像
                Glide.with(convertView.getContext())
                        .load(Contants.course_api + cb.getPhoto())
                        .placeholder(R.drawable.vote_person_photo)
                        .error(R.drawable.vote_person_photo)
                        .centerCrop()
                        .crossFade()
                        .into(viewHolder.image);
                viewHolder.image.setOnClickListener(this);
                viewHolder.image.setTag(R.id.headIv,position);
                //姓名
                viewHolder.tv_name_dynamic.setText(cb.getUserName());
                viewHolder.tv_name_class.setText(cb.getClassName());
                //文字内容
                if (!TextUtils.isEmpty(cb.getContent())) {
                    viewHolder.content.setExpand(cb.isExpand());
                    viewHolder.content.setExpandStatusListener(new ExpandTextView.ExpandStatusListener() {
                        @Override
                        public void statusChange(boolean isExpand) {
                            cb.setExpand(isExpand);
                        }
                    });

                    viewHolder.content.setText(cb.getContent());
                }
                viewHolder.content.setVisibility(TextUtils.isEmpty(cb.getContent()) ? View.GONE : View.VISIBLE);
//        Log.i("yy", "getView: " + vb.getEndTime());


                //时间
                viewHolder.timeTv.setText(cb.getCreateTime());
                //删除
                if (cb.getUserId().equals(GlobalData.getUserId(context))) {
                    viewHolder.deleteBtn.setVisibility(View.VISIBLE);
                } else {
                    viewHolder.deleteBtn.setVisibility(View.GONE);
                }
                viewHolder.deleteBtn.setOnClickListener(this);
                viewHolder.deleteBtn.setTag(R.id.deleteBtn,position);
                break;
            case 1:
                //头像
                Glide.with(convertView.getContext())
                        .load(Contants.course_api + cb.getPhoto())
                        .placeholder(R.drawable.vote_person_photo)
                        .error(R.drawable.vote_person_photo)
                        .centerCrop()
                        .crossFade()
                        .into(viewHolder.image);
                viewHolder.image.setOnClickListener(this);
                viewHolder.image.setTag(R.id.headIv,position);
                //姓名
                viewHolder.tv_name_dynamic.setText(cb.getUserName());
                viewHolder.tv_name_class.setText(cb.getClassName());
                //文字内容
                if (!TextUtils.isEmpty(cb.getContent())) {
                    viewHolder.content.setExpand(cb.isExpand());
                    viewHolder.content.setExpandStatusListener(new ExpandTextView.ExpandStatusListener() {
                        @Override
                        public void statusChange(boolean isExpand) {
                            cb.setExpand(isExpand);
                        }
                    });

                    viewHolder.content.setText(cb.getContent());
                }
                viewHolder.content.setVisibility(TextUtils.isEmpty(cb.getContent()) ? View.GONE : View.VISIBLE);
//        Log.i("yy", "getView: " + vb.getEndTime());
//                    String[] strs=cb.getImages().split(",");
//                    for(int i=0,len=strs.length;i<len;i++){
//                        System.out.println(strs[i].toString());
//                        imagePaths.add(Contants.course_api + strs[i].toString());
//                    }
                viewHolder.gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//					Toast.makeText(DynamicPublishActivity.this, "1" + position, Toast.LENGTH_SHORT).show();
                        imagePaths.clear();
                        String[] strs = cb.getImages().split(",");
                        for (int i = 0, len = strs.length; i < len; i++) {
                            System.out.println(strs[i].toString());
                            imagePaths.add(Contants.course_api + strs[i].toString());
                        }
                        PhotoPreviewIntent intent = new PhotoPreviewIntent(context);
                        intent.setCurrentItem(position);
                        //如果不加这行会导致选完图片以后在主界面点击图片预览会多出一张没有default_error 的图片
//                                imagePaths.remove(imagePaths.size() -1);
                        intent.setPhotoPaths(imagePaths);
                        ((Activity) context).startActivityForResult(intent, REQUEST_PREVIEW_CODE);

                    }
                });
                viewHolder.gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));
                int cols = convertView.getResources().getDisplayMetrics().widthPixels / context.getResources().getDisplayMetrics().densityDpi;
                cols = cols < 3 ? 3 : cols;
                //图片

                viewHolder.gridView.setNumColumns(cols);
                Log.i("yy", "getView: " + cb.getImages());
//                    imagePaths.clear();
//                    imagePaths.add(cb.getImages());
                Log.i("yy", "imagePaths: " + imagePaths);
                if (list.size() > 0 && list != null) {
                    gridAdapter = new ClassGridAdapter(context, cb.getImages());
                    viewHolder.gridView.setAdapter(gridAdapter);
                }
                //时间
                viewHolder.timeTv.setText(cb.getCreateTime());
                //删除
                if (cb.getUserId().equals(GlobalData.getUserId(context))) {
                    viewHolder.deleteBtn.setVisibility(View.VISIBLE);
                } else {
                    viewHolder.deleteBtn.setVisibility(View.GONE);
                }
                viewHolder.deleteBtn.setOnClickListener(this);
                viewHolder.deleteBtn.setTag(R.id.deleteBtn,position);
                break;
            case 2:
                final Handler handler = new Handler() {
                    @Override
                    public void handleMessage(Message msg) {
                        switch (msg.what) {
                            case 1:
                                Log.i("yy", "msg.obj==========: " + msg.obj);
                                viewHolder.video_cover.setImageBitmap((Bitmap) msg.obj);
                                break;
                        }
                        super.handleMessage(msg);
                    }
                };
                //头像
                Glide.with(convertView.getContext())
                        .load(Contants.course_api + cb.getPhoto())
                        .placeholder(R.drawable.vote_person_photo)
                        .error(R.drawable.vote_person_photo)
                        .centerCrop()
                        .crossFade()
                        .into(viewHolder.image);
                viewHolder.image.setOnClickListener(this);
                viewHolder.image.setTag(R.id.headIv,position);
                //姓名
                viewHolder.tv_name_dynamic.setText(cb.getUserName());
                viewHolder.tv_name_class.setText(cb.getClassName());
                //文字内容
                if (!TextUtils.isEmpty(cb.getContent())) {
                    viewHolder.content.setExpand(cb.isExpand());
                    viewHolder.content.setExpandStatusListener(new ExpandTextView.ExpandStatusListener() {
                        @Override
                        public void statusChange(boolean isExpand) {
                            cb.setExpand(isExpand);
                        }
                    });

                    viewHolder.content.setText(cb.getContent());
                }
                viewHolder.content.setVisibility(TextUtils.isEmpty(cb.getContent()) ? View.GONE : View.VISIBLE);
                   /* new Thread(new Runnable() {
                        @Override
                        public void run() {
                            MediaMetadataRetriever media = new MediaMetadataRetriever();
                            Bitmap frameAtTime = null;
                            try {
                                media.setDataSource(cb.getVideo(), new HashMap<String, String>());
                                frameAtTime = media.getFrameAtTime();
                                Log.i("yy", "frameAtTime==========: " + frameAtTime);
                                if (frameAtTime!=null){
                                    Message message = handler.obtainMessage();//用handler发送通知
                                    message.what = 1;
                                    message.obj = frameAtTime;
                                    handler.sendMessage(message);
                                }
                            } catch (IllegalArgumentException e) {
                                e.printStackTrace();
                            }
//                            viewHolder.video_cover.setImageBitmap(frameAtTime);
                        }
                    }).start();*/
//                    MediaMetadataRetriever media = new MediaMetadataRetriever();
//                    if (cb.getVideo().contains("http:")) {
//                        media.setDataSource(cb.getVideo(), new HashMap<String, String>());
//                    }else {
//                        media.setDataSource(Contants.course_api + cb.getVideo(), new HashMap<String, String>());
//                    }
//                    Bitmap frameAtTime = media.getFrameAtTime();
//                    viewHolder.video_cover.setImageBitmap(frameAtTime);
//        Log.i("yy", "getView: " + vb.getEndTime());
                viewHolder.video_cover.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, VideoActivity.class);
                        if (cb.getVideo().contains("http:")) {
                            intent.putExtra("video_path", cb.getVideo());
                        } else {
                            intent.putExtra("video_path", Contants.course_api + cb.getVideo());
                        }
                        intent.putExtra("isclassdynamic", "1");
                        context.startActivity(intent);
                    }
                });
                    /*viewHolder.vv_video.setVideoPath(cb.getVideo());
                    viewHolder.vv_video.start();
                    //监听视频播放完的代码
                    viewHolder.vv_video.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {

                        @Override
                        public void onCompletion(MediaPlayer mPlayer) {
                            // TODO Auto-generated method stub
                            mPlayer.start();
                            mPlayer.setLooping(true);
                        }
                    });*/
                //时间
                viewHolder.timeTv.setText(cb.getCreateTime());
                //删除
                if (cb.getUserId().equals(GlobalData.getUserId(context))) {
                    viewHolder.deleteBtn.setVisibility(View.VISIBLE);
                } else {
                    viewHolder.deleteBtn.setVisibility(View.GONE);
                }
                viewHolder.deleteBtn.setOnClickListener(this);
                viewHolder.deleteBtn.setTag(R.id.deleteBtn,position);
                break;
        }
        return convertView;
    }


    //    class ViewHolder1 {
//        ImageView image ;
//        TextView tv_name_dynamic;
//        ExpandTextView content;
//        TextView timeTv;
//        TextView deleteBtn;
//        TextView tv_name_class;
//
//    }
//
//    class ViewHolder3  {
//        ImageView image ;
//        TextView tv_name_dynamic;
//        ExpandTextView content;
//        TextView timeTv;
//        TextView deleteBtn;
//        TextView tv_name_class;
//        VideoView vv_video;
//    }
//    class ViewHolder2  {
//        ImageView image ;
//        TextView tv_name_dynamic;
//        ExpandTextView content;
//        TextView timeTv;
//        TextView deleteBtn;
//        TextView tv_name_class;
//        MyGridView gridView;
//
//    }
    class ViewHolder {
        ImageView image;
        ImageView video_cover;
        TextView tv_name_dynamic;
        ExpandTextView content;
        TextView timeTv;
        TextView deleteBtn;
        TextView tv_name_class;
        VideoView vv_video;
        MyGridView gridView;
    }
}
